import React, { FC, useEffect, useState } from "react";
import { FileSearchOutlined } from "@ant-design/icons";
import { Typography, Space } from "antd";
import { Link } from "react-router-dom";
import classNames from "classnames/bind";
import style from "./index.module.scss";
//获取数据管理的自定义hooks
import useGetUserInfo_redux from "../../hooks/useGetUserInfo_redux";
import { HOME_PATHNAME, MANAGE_INDEX_PATHNAME } from "../../route";
const BCN = classNames.bind(style);
const { Title } = Typography;
const Logo: FC = () => {
  const { username } = useGetUserInfo_redux();
  const [pathname, setpathname] = useState(HOME_PATHNAME);
  useEffect(() => {
    if (username) {
      setpathname(MANAGE_INDEX_PATHNAME);
    }
  }, [username]);
  return (
    <Link to={HOME_PATHNAME}>
      <Typography className={BCN("logo")}>
        <Space direction="horizontal">
          <Title>
            <FileSearchOutlined />
          </Title>
          <Title>萝卜的问卷</Title>
        </Space>
      </Typography>
    </Link>
  );
};

export default Logo;
